package com.my.design.create.protype;

import java.util.*;

/**
 * @author 代廷波
 * @className: Test
 * @description:
 * @create 2018/12/12 0012-14:18
 **/
public class Test {
    public static void main(String[] args) throws CloneNotSupportedException {
        ProtypeVO parentVo = new ProtypeVO();
        Date date = new Date();
        parentVo.setDate(date);
        List<ProtypeVO> list = new ArrayList<>();
        ProtypeVO childrenVo = null;
        Long time1 = System.currentTimeMillis();
        for (int i = 0; i <100000; i++) {
            childrenVo = new ProtypeVO();
            childrenVo.setId(i);

            childrenVo.setDate(date);
            childrenVo.setAddr("测试地址"+i);
            list.add(childrenVo);
        }
        Long time2 = System.currentTimeMillis();
        System.out.println(time2-time1);

        Long time3 = System.currentTimeMillis();
        for (int i = 0; i <100000; i++) {
            childrenVo = (ProtypeVO)parentVo.clone();
            childrenVo.setId(i);
            childrenVo.setAddr("测试地址"+i);
            list.add(childrenVo);
        }
        Long time4 = System.currentTimeMillis();
        System.out.println(time4-time3);

    }

}
